#include "GameObject3DPhysics.h"

void GameObject3DPhysics::Init()
{

}
void GameObject3DPhysics::Render()
{
	if (rigiBody && rigiBody->getMotionState())
	{
		Device_Base::GetInstance()->PushMatrix();
		btTransform trans;
		rigiBody->getMotionState()->getWorldTransform(trans);
		Matrix matrixTransform;
		matrixTransform.SetIdentity();
		trans.getOpenGLMatrix((btScalar*)&matrixTransform);
		Device_Base::GetInstance()->Transform(matrixTransform);
		Device_Base::GetInstance()->BindVBO(vbo);
		Device_Base::GetInstance()->UpdateVertexAttribPointer();
		Device_Base::GetInstance()->SetUniformMatrix(UNIFORM_MATRIX_MODEL, Device_Base::GetInstance()->GetMatrixWorld());
		Device_Base::GetInstance()->SetUniformMatrix(UNIFORM_MATRIX_VIEW, Device_Base::GetInstance()->GetMatrixView());
		Device_Base::GetInstance()->SetUniformMatrix(UNIFORM_MATRIX_PROJECTION, Device_Base::GetInstance()->GetMatrixProjection());
		Device_Base::GetInstance()->DrawArray(Device_Base::PRIMITIVE_TRIANGLE_LIST, 0, vbo->vertexCount);
		Device_Base::GetInstance()->PopMatrix();
	}
}
void GameObject3DPhysics::Update(float timeDelta)
{

}
void GameObject3DPhysics::Release()
{

}
GameObject3DPhysics::GameObject3DPhysics(VBO* vboIn, btRigidBody* body)
{
	this->rigiBody = body;
	this->vbo = vboIn;
}